﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using KPIS.GERP.GHRMS.DALFactory;
using KPIS.GERP.GHRMS.IDAL;
using KPIS.GERP.GHRMS.IBLL;
using KPIS.GERP.GHRMS.MODEL;

namespace KPIS.GERP.GHRMS.BLL
{
    public class ClassSpecificationBLL : IClassSpecificationBLL
    {
        private static readonly IClassSpecificationDAL DAL = DataAccess.CreateClassSpecifications();
        private static readonly IPositionTypeDAL posDAL = DataAccess.CreatePositionTypes();

        private PositionTypeInfo posInfo = new PositionTypeInfo();
        public IList<ClassSpecificationInfo> ListClassSpecification(Nullable<int> Sequence, Nullable<int> PositionTypes)
        {
            return DAL.ListClassSpecification(Sequence, PositionTypes);
        }
        public DataSet LoadClassSpecification(Nullable<int> Sequence, Nullable<int> PositionTypes)
        {
            return DAL.LoadClassSpecification(Sequence, PositionTypes);
        } 
        public void Insert(string Name, string NameEng, int PositionTypes, int CreatedBy)
        {
            try
            {
                posInfo.Sequence = PositionTypes;

                DAL.Insert(new ClassSpecificationInfo(0, Name, NameEng, posInfo, "", CreatedBy, 0));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Update(int Sequence, string Name, string NameEng, int PositionTypes, int UpdatedBy)
        {
            try
            {
                posInfo.Sequence = PositionTypes;

                DAL.Update(new ClassSpecificationInfo(Sequence, Name, NameEng, posInfo, "", 0, UpdatedBy));
            }
            catch
            {
                throw new Exception("");
            }
        }
        public void Delete(int Sequence, int UpdatedBy)
        {
            try
            {
                DAL.Delete(Sequence, UpdatedBy);
            }
            catch
            {
                throw new Exception("");
            }
        }
        
    }
}
